//
//  HomeWalletAddressCell.m
//  ShandsMod
//
//  Created by zh_s on 2023/3/17.
//  Copyright © 2023 zh_s. All rights reserved.
//

#import "HomeWalletAddressCell.h"

@implementation HomeWalletAddressCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.accessoryType = UITableViewCellAccessoryNone;
        self.backgroundColor = [UIColor clearColor];
        [self createView];
    }
    return self;
}

- (void)createView {
    UIView *backV = [[UIView alloc] init];
    [self.contentView addSubview:backV];
//    backV.backgroundColor = UIColor.redColor;
    backV.frame = CGRectMake(20, 0, SCREEN_WIDTH - 40, 41);

    
    UIImageView *backImage = [[UIImageView alloc] init];
    backImage.image = IMAGE_NAME(@"bg_home_address");
    backImage.contentMode = UIViewContentModeScaleAspectFill;
//    backImage.clipsToBounds = YES
    backImage.userInteractionEnabled = YES;
    [backV addSubview:backImage];
//    backImage.frame = CGRectMake(5, 0, SCREEN_WIDTH - 5, 40);
    [backImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(5);
        make.left.mas_equalTo(-20);
        make.right.mas_equalTo(backV.mas_right).mas_offset(20);
        make.height.mas_equalTo(40);
    }];
    
//    UIImageView *bottomV = [[UIImageView alloc] init];
//    bottomV.image = IMAGE_NAME(@"");
//    [self.contentView addSubview:bottomV];
//    [bottomV mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.mas_equalTo(67);
//        make.left.mas_equalTo(15);
//        make.right.mas_equalTo(backV.mas_right).mas_offset(-15);
//        make.height.mas_equalTo(41);
//    }];
    

    UIImageView *addressIcon = [[UIImageView alloc] init];
    addressIcon.image = IMAGE_NAME(@"icon_home_address");
    [backV addSubview:addressIcon];
    [addressIcon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.centerY.mas_equalTo(backImage.mas_centerY).mas_offset(-4);
        make.width.height.mas_equalTo(16);
        
    }];
    
    addressIcon.frame = CGRectMake(15, 0, SCREEN_WIDTH - 10, 40);
    
    UILabel *titleLab = [[UILabel alloc] init];
    [backV addSubview:titleLab];
    titleLab.textColor = MAIN_BACKCOLOR;
    titleLab.font = FONT_NAME(FONT_Regular, 14);
    titleLab.text = @"钱包地址";
    [titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(40);
        make.centerY.mas_equalTo(addressIcon.mas_centerY);
        make.height.mas_equalTo(22);
    }];
    
    
    UIImageView *moreImg = [[UIImageView alloc] init];
    [backV addSubview:moreImg];
    moreImg.image = IMAGE_NAME(@"icon_home_addressMore");
    [moreImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(backV.mas_right).mas_offset(-25);
        make.width.height.mas_equalTo(18);
        make.centerY.mas_equalTo(addressIcon.mas_centerY);
    }];
    
}

@end
